package com.cn.modules;
import java.util.List;

import com.cn.common.utils.Message;
import com.cn.component.valdation.VerifyLoginControoller;
import com.cn.modules.login.LoginValidator;
import com.cn.modules.user.model.User;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;


public class LoginController  extends Controller{
	public VerifyLoginControoller controoller=new VerifyLoginControoller();
	public void index(){
			render("login.jsp");
	}
	
	@Before(LoginValidator.class)
	public void login(){
//		boolean flag=controoller.valdation(getRequest());
//		if(!flag){
//			render("login.jsp");
//			return;
//		}
		User user=User.me.login(getPara(0), getPara(1));
	    if(user==null){
	    	renderJson(new Message(false, ""));
	    }else{
	    	renderJson(new Message(true, ""));
	    	setSessionAttr("user", user);
	    }
	
	
//		getRequest().setAttribute("menuList", arg1);
//		render("/view/index/index.jsp");
	}
}
